package com.thread;

import org.junit.Test;

/**
 * @author Conceit
 * @version 1.0, 2017/1/3
 */
public class ExecuteThread {

    @Test
    public void run() {
        TestThreadRun testThreadOne = new TestThreadRun("线程1");
        TestThreadRun testThreadTwo = new TestThreadRun("线程2");
        TestThreadRun testThreadThree = new TestThreadRun("线程3");
        testThreadOne.start();//start（）方法来启动线程，真正实现了多线程运行。
        testThreadTwo.start();//
        //testThreadThree.run();//run（）方法当作普通方法的方式调用
    }

    @Test
    public void runable() {

        TestThreadRunable testThreadRunable = new TestThreadRunable();
        new Thread(testThreadRunable, "线程1").start();
        new Thread(testThreadRunable, "线程2").start();
        new Thread(testThreadRunable, "线程3").start();
        new Thread(testThreadRunable, "线程4").start();
        new Thread(testThreadRunable, "线程5").start();

    }


}
